Skip to main content

Packages Cloning and Colcon Build

This document provides comprehensive, step-by-step instructions for cloning software packages from the Goat Robotics GitHub page, installing necessary dependencies, and building the packages using Colcon, a command-line tool for building packages in ROS 2 (Robot Operating System).

GOAT Robotics

3.1 Create a Workspace and Source Directory

Before you can clone and build the packages, you need to set up a workspace in your file system. A workspace is a directory structure that ROS uses to manage multiple packages.

Step 1: Create the Workspace Directory

To create a workspace, execute the following command in your terminal:

mkdir -p goat_ws/src

Explanation:

  • mkdir: This command stands for "make directory." It creates new directories in the file system.
  • -p: This option allows the creation of parent directories as needed. If goat_ws does not exist, it will be created along with the src subdirectory.
  • goat_ws/src: This is the structure being created. goat_ws is the main workspace directory, and src is where you will clone your ROS packages.

Step 2: Navigate to the Source Directory

After creating the directory structure, navigate to the src directory where you will clone the required packages:

cd goat_ws/src

Explanation:

  • cd: This command stands for "change directory." It allows you to navigate into a specified directory.
  • goat_ws/src: This is the path to the newly created source directory.

3.2 Git Clone Packages

Now that you are in the correct directory, you can clone the necessary software packages from the Goat Robotics GitHub repository.

GOAT Robotics

Step 1: Clone the Repository

Execute the following command to clone a specific repository:

git clone https://github.com/GoatRobotics/your-repository.git

Explanation:

  • git clone: This command copies a repository from a remote source (in this case, GitHub) to your local machine.
  • https://github.com/GoatRobotics/your-repository.git: Replace your-repository with the actual name of the repository you wish to clone. This command downloads all files and the history of the project into your current working directory.

Required Packages

Make sure to clone the following packages to ensure you have all the necessary components for Goat Robotics:

  • Jarvisbot_bringup: The package that contains launch files to start the robot's nodes.
  • Jarvisbot_control: Handles the control of the robot's movements and actions.
  • Jarvisbot_description: Contains models and descriptions of the robot's components.
  • Jarvisbot_firmware: Manages the firmware for the robot's hardware components.
  • Jarvisbot_gazebo: Integrates the robot with the Gazebo simulation environment.
  • Jarvisbot_navigation: Provides algorithms for navigation and path planning.
  • Jarvisbot_slam: Supports simultaneous localization and mapping (SLAM) functionalities.
  • V4l2 camera: Manages the camera interface for video capture.
  • Ydlidar_ros2_driver: Interfaces with the YDLidar sensor for distance measurement.
  • YDLidar SDK: Software development kit for the YDLidar sensor.

3.3 Colcon Build

After cloning the necessary packages, you will build them using Colcon.

Step 1: Navigate to the Workspace

Change your directory to the root of your workspace by executing:

cd ~/goat_ws

Explanation:

  • cd ~/goat_ws: This command takes you to the goat_ws directory you created earlier. The tilde (~) represents your home directory.

Step 2: Install Package Dependencies

Before building the packages, you need to install any external dependencies that they require. Use rosdep to automate this process:

rosdep install --from-paths src --ignore-src -r -y

Explanation:

  • rosdep: A command-line tool that installs system dependencies for ROS packages.
  • install: This subcommand tells rosdep to install the required dependencies.
  • --from-paths src: This option specifies the directory from which to look for package dependencies.
  • --ignore-src: This flag indicates that it should not consider packages in the source directory as dependencies.
  • -r: This flag resolves dependencies recursively.
  • -y: This option automatically confirms the installations without prompting you.

Step 3: Additional Dependencies

You may need to manually install some specific dependencies. Execute the following command to install them:

sudo apt install ros-humble-joint-state-publisher ros-humble-robot-state-publisher ros-humble-cartographer ros-humble-cartographer-ros ros-humble-gazebo-plugins ros-humble-teleop-twist-keyboard ros-humble-teleop-twist-joy ros-humble-xacro ros-humble-nav2* ros-humble-urdf

Explanation:

  • sudo: This command allows you to run the installation with superuser privileges, which is often required for installing packages.
  • apt install: This is the command to install software packages on Debian-based systems.
  • ros-humble-*: This prefix indicates that you are installing packages for the ROS 2 Humble distribution. Each package serves different functionalities, from state publishing to navigation.

Step 4: Build the Packages

Now that all dependencies are installed, you can build the cloned packages using Colcon:

colcon build

Explanation:

  • colcon build: This command compiles all the packages in the workspace. It resolves dependencies among the packages and ensures that everything is built in the correct order.

Step 5: Source the Workspace

Once the build process is complete, you need to source the setup file to make the newly built packages available for use:

source install/setup.bash

Explanation:

  • source: This command executes the specified file in the current shell, allowing any environment variables or paths defined in that file to take effect.
  • install/setup.bash: This script sets up the environment so that the terminal recognizes the newly built packages.

Conclusion

Following these detailed steps will ensure that the packages cloned from the repository are properly built and ready for execution. You can now proceed to use the Goat Robotics software for your projects. If you encounter any issues during this process, double-check the commands and ensure all dependencies are correctly installed.